package com.abc.controller;

import com.abc.bean.Doctor;
import com.abc.bean.Patient;
import com.abc.service.DoctorService;
import com.abc.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: bc
 * @Date: 2024-11-17 12:44
 * @Description:
 */
@RestController()
@RequestMapping("/doctor")
public class DoctorController {

    @Autowired
    private DoctorService doctorService;

    @RequestMapping("/selectDoctor")
    public List<Doctor> selectDoctor(String doctorName) {
        return doctorService.selectDoctor(doctorName);
    }
     @RequestMapping("/selectAllDoctor")
    public List<Doctor> selectAllDoctor(){
        return doctorService.selectAllDoctor();
    }

    @RequestMapping("/selectOneDoctorById")
    public Doctor selectOneDoctorById(String id) {
        return doctorService.selectOneDoctorById(id);
    }
    @RequestMapping("/addDoctor")
    public String addDoctor(Doctor doctor) {
        return doctorService.addDoctor(doctor);
    }
    @RequestMapping("/deleteDoctor")
    public String deleteDoctor(String id) {
        return doctorService.deleteDoctor(id) > 0 ? "删除成功" : "删除失败";
    }
    @RequestMapping("/updateDoctorById")
    public String updateDoctorById(Doctor doctor) {
        return doctorService.updateDoctorById(doctor) > 0 ? "修改成功" : "修改失败";
    }

}
